"""
肺结节CT场景数据模型
"""

from pydantic import BaseModel
from typing import List, Optional

class NoduleDetectionTask(BaseModel):
    """肺结节检测任务信息"""
    id: str = "detection"
    name: str = "肺结节检测"
    description: str = "自动检测CT影像中的肺结节区域"
    icon: str = "🔍"

class NoduleSegmentationTask(BaseModel):
    """肺结节分割任务信息"""
    id: str = "segmentation"
    name: str = "肺结节分割"
    description: str = "精确分割肺结节区域边界"
    icon: str = "✂️"

class NoduleClassificationTask(BaseModel):
    """肺结节良恶性分类任务信息"""
    id: str = "classification"
    name: str = "肺结节良恶性分类"
    description: str = "对检测到的肺结节进行良恶性分类诊断"
    icon: str = "📊"

class NoduleDetectionResult(BaseModel):
    """结节检测结果"""
    id: str
    center_x: float
    center_y: float
    center_z: float
    diameter: float
    volume: float
    confidence: float

class NoduleSegmentationResult(BaseModel):
    """结节分割结果"""
    nodule_id: str
    mask: str  # 分割掩码（base64编码）
    boundary_points: List[List[float]]  # 边界点坐标
    confidence: float

class NoduleClassificationResult(BaseModel):
    """结节分类结果"""
    nodule_id: str
    classification: str  # "benign" 或 "malignant"
    confidence: float
    features: dict  # 提取的特征信息

class LungNoduleProcessingResult(BaseModel):
    """肺结节处理完整结果"""
    detections: Optional[List[NoduleDetectionResult]] = None
    segmentations: Optional[List[NoduleSegmentationResult]] = None
    classifications: Optional[List[NoduleClassificationResult]] = None
    # lung_mask: Optional[str] = None  # 肺部分割掩码（base64编码）